<style lang="less">
</style>
<template>
  <div class="login">
    <Table
      border highlight-row
      :columns="columns" :data="tableData"></Table>
  </div>
</template>
<script>
import { getUserList } from '@/api/users'

export default {
  components: {
  },
  data () {
    return {
      registerNum: '',
      tableData: [],
      columns: [{
        type: 'index',
        width: 60,
        align: 'center'
      }, {
        title: '姓名',
        key: 'name'
      }, {
        title: '验证码',
        key: 'verifycode'
      }, {
        title: 'Action',
        key: 'action',
        width: 150,
        align: 'center',
        render: (h, params) => {
          return h('div', [
            h('Button', {
              props: {
                type: 'primary',
                size: 'small'
              },
              style: {
                marginRight: '5px'
              },
              on: {
                click: () => {
                  this.show(params.index)
                }
              }
            }, '通过'),
            h('Button', {
              props: {
                type: 'error',
                size: 'small'
              },
              on: {
                click: () => {
                  this.remove(params.index)
                }
              }
            }, '拒绝')
          ])
        }
      }]
    }
  },
  created () {
    let param = {
      groupid: localStorage.groupid, isChecked: 0
    }
    getUserList(param).then(res => {
      console.log(res)
      this.tableData = res.data.rows
    })
  },
  methods: {
    btnAddClick () {
      let res = []
      for (var i = 0; i < this.registerNum; i++) {
        let code = (new Date()).valueOf()
        // eslint-disable-next-line no-unused-vars
        let param = {
          groupid: 1, code
        }
        addCode(param).then(res => {
          console.log(res)
        })
        res.push({code})
        this.tableData = res
      }
    }
  }
}

</script>
<style>
</style>
